public class eventdeleteoverride{
    public string msg{get;set;}
    string url;
         public string idStr{
        get{ 
            return System.currentPageReference().getParameters().get('id');
            }
            set;
            }
    public eventdeleteoverride(ApexPages.StandardController controller) {
        this.controller = controller;
    }    
    public pagereference home(){
        PageReference ref=new PageReference('/home/home.jsp');
        ref.setRedirect(true);
        return ref;
    
    }
    public pagereference back(){ 
        PageReference ref=new PageReference('/'+idstr);
        ref.setRedirect(true);
        return ref;
    
    }
  public pagereference newdelete(){
    msg='删除操作无效。';
    return null;
    /*
    id eid = ApexPages.currentPage().getParameters().get('id'); 
    List<event> eventl=new List<event>();
    List<HCPEducation__c> hcpl=new List<HCPEducation__c>();  
    List<CallPlan__c> cpl=new List<CallPlan__c>();  
    List<ConsumerEducation__c> csel=new List<ConsumerEducation__c>();
    eventl=[select whatid from event where id=:eid];
    
    if(eventl.size()>0){
    hcpl=[select id from HCPEducation__c where id=:eventl[0].whatid];
    cpl=[select id from CallPlan__c where id=:eventl[0].whatid];
    csel=[select id from ConsumerEducation__c where id=:eventl[0].whatid];
  
    if(hcpl.size()>0) delete hcpl[0];
    if(cpl.size()>0) delete cpl[0];
    if(csel.size()>0) delete csel[0];
    }
    

    
    PageReference ref=new PageReference('https://cs5.salesforce.com/home/home.jsp');
    
       ref.setRedirect(true);
        return ref;
        */
  }
 private final ApexPages.StandardController controller;
 
    static testMethod void eventdeleteoverrideTest()
    {
        Profile p  = [select id from profile where name = 'System Administrator'or name =: '系统管理员'];
        
        User u1 = new User (alias = 'standt', email = 'shuaicao@isoftstone.com', emailencodingkey='UTF-8', 
                lastname = 'Testing', languagelocalekey = 'en_US', localesidkey='en_US', Title__c = 'Sales Rep',profileid = p.id, 
                timezonesidkey = 'America/Los_Angeles', username='standarduser@testorg1.com');
        insert u1;
  
    
        event add = new event();
        add.OwnerId  = u1.Id;
        add.Subject = '拜访';
        add.ActivityDateTime = dateTime.Now();
        add.DurationInMinutes = 50;
        
        insert add;
              
        test.setCurrentPageReference(Page.eventdeletebuttonoverride);
        System.currentPageReference().getParameters().put('id', add.Id); 
        
        ApexPages.StandardController del = new ApexPages.StandardController(add);
        eventdeleteoverride testCase = new eventdeleteoverride(del);
        testCase.newdelete(); 
        
        testCase.home();
        testCase.back();
    }
   
    
    
   
}